package animal;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-06-26
 * Time: 22:30
 */
public class Cat extends Animal{
    @Override
    public void eat() {
        super.name = "wangcai";
        super.eat();
    }

    public static Animal func2() {
        Cat cat = new Cat();
        return cat;
    }

    public static void main(String[] args) {

        /**
         * Cat和Fish形成多态
         */

        //通过返回值，向上转型
        Animal animal = new Cat();
        animal.eat();

        //通过，传参向上转型
        Fish fish = new Fish();
        fish.func1(fish);
    }
}
